package code1_100.code1_10;

import java.util.Map;
import java.util.Stack;

public class Code7 {

    static class Solution {

        public int reverse(int x) {
            int num=0;
            while (x!=0){
                if (num!=0&&(num!=num*10/10))
                    return 0;
                num=num*10+x%10;
                x/=10;

                if (num!=0&&Integer.MAX_VALUE/Math.abs(num)<1)
                    return 0;
            }
            return num;
        }
    }

    public static void main(String[] args) {
        System.out.println(new Code7.Solution().reverse(123));


    }
}
